package base.shiro.demo.user;

import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Override
    public UserEntity login() {
        return null;
    }

    @Override
    public void loginOut() {

    }

    @Override
    public UserEntity getUserByName(String name) {
        UserEntity userEntity = new UserEntity();
        userEntity.setName("张山");
        userEntity.setPassword("123456");
        userEntity.setStatus(1);
        RoleEntity roleEntity = new RoleEntity();
        roleEntity.setRoleName("管理员");
        PermissionsEntity permissionsEntity = new PermissionsEntity();
        permissionsEntity.setPermissionsName("查看");
        PermissionsEntity permissionsEntity2 = new PermissionsEntity();
        permissionsEntity2.setPermissionsName("修复");
        PermissionsEntity permissionsEntity3 = new PermissionsEntity();
        permissionsEntity3.setPermissionsName("删除");
        PermissionsEntity permissionsEntity4 = new PermissionsEntity();
        permissionsEntity4.setPermissionsName("新增");
        List<PermissionsEntity> permissionsEntityList = new ArrayList<>();
        permissionsEntityList.add(permissionsEntity);
        permissionsEntityList.add(permissionsEntity2);
        permissionsEntityList.add(permissionsEntity3);
        permissionsEntityList.add(permissionsEntity4);
        roleEntity.setPermissionsList(permissionsEntityList);
        userEntity.setRoles(Collections.singletonList(roleEntity));
        return userEntity;
    }
}
